import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { OrderComponent } from './pages/order/order.component';
import { PaymentComponent } from './pages/payment/payment.component';
import { RefundComponent } from './pages/refund/refund.component';
import { ContractComponent } from './pages/contract/contract.component';
import { InvoiceComponent } from './pages/invoice/invoice.component';
import { BillComponent } from './pages/bill/bill.component';
import { OrderDetailComponent } from './pages/order-detail/order-detail.component';
import { PaymentDetailComponent } from './pages/payment-detail/payment-detail.component';
import { RefundDetailComponent } from './pages/refund-detail/refund-detail.component';
import { ContractDetailComponent } from './pages/contract-detail/contract-detail.component';
import { InvoiceDetailComponent } from './pages/invoice-detail/invoice-detail.component';
import { BillDetailComponent } from './pages/bill-detail/bill-detail.component';
import { PayReconciliationsComponent } from './pages/pay-reconciliations/pay-reconciliations.component';
import { InvoiceReconciliationsComponent } from './pages/invoice-reconciliations/invoice-reconciliations.component';
import { PayDetailRecComponent } from './pages/pay-detail-rec/pay-detail-rec.component';
import { InvoiceDetailRecComponent } from './pages/invoice-detail-rec/invoice-detail-rec.component';

const routes: Routes = [
    {
        path: 'order', component: OrderComponent, data: {
            breadcrumbs: [{ title: '采购订单' }]
        },
        children: [
            {
                path: 'detail', component: OrderDetailComponent, data: {
                    breadcrumbs: [{ title: '采购订单', path: '/purchase/order' }, { title: '新增' }]
                }
            },
            {
                path: 'detail/:id', component: OrderDetailComponent, data: {
                    breadcrumbs: [{ title: '采购订单', path: '/purchase/order' }, { title: '修改' }]
                }
            },
        ]
    },
    {
        path: 'payment', component: PaymentComponent, data: {
            breadcrumbs: [{ title: '采购付款' }]
        },
        children: [
            {
                path: 'detail', component: PaymentDetailComponent, data: {
                    breadcrumbs: [{ title: '采购付款', path: '/purchase/payment' }, { title: '新增采购付款' }]
                }
            },
        ]
    },
    {
        path: 'refund', component: RefundComponent, data: {
            breadcrumbs: [{ title: '采购退单' }]
        },
        children: [
            {
                path: 'detail', component: RefundDetailComponent, data: {
                    breadcrumbs: [{ title: '采购退单', path: '/purchase/refund' }, { title: '新增采购退单' }]
                }
            },
        ]
    },
    {
        path: 'contract', component: ContractComponent, data: {
            breadcrumbs: [{ title: '采购合同' }]
        },
    children: [
        {
            path: 'detail', component: ContractDetailComponent, data: {
                breadcrumbs: [{ title: '采购合同', path: '/purchase/contract' }, { title: '新增采购合同' }]
            }
        },
        {
            path: 'detail/:supplierId', component: ContractDetailComponent, data: {
                breadcrumbs: [{ title: '采购合同', path: '/purchase/contract' }, { title: '新增采购合同' }]
            }
        },
    ]
    },
    {
        path: 'invoice', component: InvoiceComponent, data: {
            breadcrumbs: [{ title: '采购发票' }]
        },
        children: [
            {
                path: 'detail', component: InvoiceDetailComponent, data: {
                    breadcrumbs: [{ title: '采购发票', path: '/purchase/invoice' }, { title: '新增采购发票' }]
                }
            },
        ]
    },
    {
        path: 'bill', component: BillComponent, data: {
            breadcrumbs: [{ title: '采购制单' }]
        },
        children: [
            {
                path: 'detail', component: BillDetailComponent, data: {
                    breadcrumbs: [{ title: '采购制单', path: '/purchase/bill' }, { title: '新增采购制单' }]
                }
            },
        ]
    },
    {
            path: 'pay-reconciliations', component: PayReconciliationsComponent, data: {
                breadcrumbs: [{ title: '采购付款对账', path: '/purchase/pay-reconciliations' }, { title: '自动对账' }]
            },
        children: [
            {
                path: 'detail', component: PayDetailRecComponent, data: {
                    breadcrumbs: [{ title: '采购付款对账', path: '/purchase/pay-reconciliations' }, { title: '手工对账' }]
                }
            }]
        },
    {
        path: 'invoice-reconciliations', component: InvoiceReconciliationsComponent, data: {
            breadcrumbs: [{ title: '采购发票对账', path: '/purchase/invoice-reconciliations' }, { title: '自动对账' }]
        },
        children: [
        {
                path: 'detail', component: InvoiceDetailRecComponent, data: {
                    breadcrumbs: [{ title: '采购发票对账', path: '/purchase/invoice-reconciliations' }, { title: '手工对账' }]
            }
        }]
    }
];

export const declarationComponents = [
    OrderComponent,
    PaymentComponent,
    RefundComponent,
    ContractComponent,
    InvoiceComponent,
    BillComponent,
    OrderDetailComponent,
    PaymentDetailComponent,
    RefundDetailComponent,
    ContractDetailComponent,
    InvoiceDetailComponent,
    BillDetailComponent,
    PayReconciliationsComponent,
    InvoiceReconciliationsComponent,
    PayDetailRecComponent,
    InvoiceDetailRecComponent,

];

export const entryComponents = [
    OrderComponent,
    PaymentComponent,
    RefundComponent,
    ContractComponent,
    InvoiceComponent,
    BillComponent,
    OrderDetailComponent,
    PaymentDetailComponent,
    RefundDetailComponent,
    ContractDetailComponent,
    InvoiceDetailComponent,
    BillDetailComponent,
    PayReconciliationsComponent,
    InvoiceReconciliationsComponent,
    PayDetailRecComponent,
    InvoiceDetailRecComponent,
];

@NgModule({
    imports: [
        RouterModule.forChild(routes)
    ],
    exports: [
        RouterModule
    ]
})
export class PurchaseRoutingModule { }
